package cz.muni.fi.pa165.dao;

import cz.muni.fi.pa165.entity.Customer;
import java.util.List;
import javax.ejb.Local;

/**
 * This interface specify contract of Customer Data Access Object.
 * 
 * @author <a href="mailto:vramik at redhat.com">Vlastislav Ramik</a>
 */
@Local
public interface CustomerDAO {
    
    /**
     * Stores new customer into database.
     * 
     * @param customer New customer to add into database.
     * @throws IllegalArgumentException if customer is null, customer's id is not null, any other customer's attribute is null or 
     * empty and if address is not in form: "Street number, City, ZIPCode"
     */
    public void createCustomer(Customer customer);
    
    /**
     * Removes customer from database.
     * 
     * @param customer Customer to remove from database.
     * @throws IllegalArgumentException if customer is null, id is null and any customer's attribute is inconsistent with DB 
     * customer's attribute.
     */
    public void removeCustomer(Customer customer);
    
    /**
     * Updates customer in database.
     * 
     * @param customer Customer to update from database.
     * @throws IllegalArgumentException if customer is null, id is null, any other customer's attribute is null or empty and if 
     * address is not in form: "Street number, City, ZIPCode"
     */
    public void updateCustomer(Customer customer);
    
    /**
     * Returns list of all customers.
     * 
     * @return List<Customer> list of all customers
     */
    public List<Customer> getAllCustomers();        
    
    /**
     * Returns customer with given id from database.
     * 
     * @param id customer's id 
     * @return Customer with given id
     */
    public Customer getCustomerById(Long id);
}
